<template>
  <!-- 选择音频分类 -->
  <div class="select_classify">
    <el-table ref="multipleTable" :data="list" v-loading="loading" stripe header-row-class-name="head_color"
      tooltip-effect="dark" style="width: 99.9%">

      <el-table-column label="标题" min-width="80">
        <template slot-scope="scope">{{ scope.row.title }}</template>
      </el-table-column>

      <el-table-column label="图片" min-width="150" align="center">
        <template slot-scope="scope">
          <div class="user_table">
            <img :src="$fnc.getImgUrl(scope.row.piclink)" style="width:150px;height:80px;" alt />
          </div>
        </template>
      </el-table-column>
      <el-table-column label="添加时间" min-width="100">
        <template slot-scope="scope">{{ scope.row.created_time | getTimeFormat }}</template>
      </el-table-column>
      <el-table-column label="更新时间" min-width="100">
        <template slot-scope="scope">{{ scope.row.update_time | getTimeFormat }}</template>
      </el-table-column>

      <el-table-column label="操作" align="center" min-width="120">
        <template slot-scope="scope">
          <el-button :loading="$store.state.isLoading" size="mini" type="primary" @click="addClass(scope.row)">添加</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        list: [],
        loading: true,
      }
    },
    methods: {
      getNovel() {
        //获取音频分类
        this.$api.getNovel.getAudioClassify().then(res => {
          if (res.data.code == 200) {
            this.list = res.data.result;
          }
          this.loading = false;
        })
      },
      addClass(row) {
        //添加
        this.$emit("classSelect", row, false);
      },
    },
    created() {
      this.getNovel();
    }
  }
</script>

<style>
</style>
